﻿using HZY.Framework.DependencyInjection;
using Long.Helper;
using Long.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Long.DAL
{
    public class UserService:BaseService<UserEntity>,IScopedSelfDependency
    {
        public async Task<BaseResult<UserEntity>> LoginAsyncService(UserEntity userEntity)
        {
            BaseResult<UserEntity> result = new BaseResult<UserEntity>();
            var res = await DB.SqlSugarClient.Queryable<UserEntity>().Where(x => x.UserName == userEntity.UserName && x.UserPassword == userEntity.UserPassword).FirstAsync();
            
            if (res == null)
            {
                result.ResultStatus = SystemEnums.ResultStatus.Fail;
                result.Msg = "用户名或密码错误";
                return result;
            }
            result.Data = new List<UserEntity> { res };
            return result;
            
        }
    }
}
